package com.czxy.Demo10;

import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        String[] strs = {"12","345","6789","1","123","4567"};
        List<String> listOdd = new ArrayList<>();  // 奇数长度集合
        List<String> listEven = new ArrayList<>(); // 偶数长度集合

        for (int i = 0; i < strs.length ; i++) {
            if (strs[i].length() % 2 == 0){     //  当能被2整除时 判断为偶数
                listEven.add(strs[i]);  //  将数据添加到偶数集合中
            }else{
                listOdd.add(strs[i]);   //  否则 则为奇数
            }
        }

        System.out.println("偶数长度字符串:"+listEven.toString());
        System.out.println("奇数长度字符串:"+listOdd.toString());
    }
}
